package com.concurrency.practise.service;

import com.concurrency.practise.entity.Dog;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * @program: currency_practise
 * @description:
 * @author: Jiliang.Lee
 * @create: 2019-12-12 14:08
 **/
@Service
@AllArgsConstructor
public class SynchronizeService {
	private final DogService dogService;

	public synchronized Dog synchronizedBuyDog() throws Exception {
		return dogService.buyDog(1L);
	}

	public synchronized Dog synchronizedBuyDogWithDb() {
		return dogService.buyDogWithDB(1L);
	}
}
